{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "4bb7f8ed-8f0f-4c5b-9b03-855d5a857c7a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Working on a Windows 10\n", "Python version 3.11.7 | packaged by Anaconda, Inc. | (main, Dec 15 2023, 18:05:47) [MSC v.1916 64 bit (AMD64)]\n", "Pandas version 2.1.4\n", "bifacial_radiance version 0+untagged.1553.g23d2640.dirty\n" ] } ], "source": [ "# This information helps with debugging and getting support :)\n", "import sys, platform\n", "import pandas as pd\n", "import bifacial_radiance as br\n", "print(\"Working on a \", platform.system(), platform.release())\n", "print(\"Python version \", sys.version)\n", "print(\"Pandas version \", pd.__version__)\n", "print(\"bifacial_radiance version \", br.__version__)" ] }, { "cell_type": "markdown", "id": "080e6447", "metadata": {}, "source": [ "# 16 - AgriPV - 3-up and 4-up collector optimization\n", "\n", "\n", "This journal helps the exploration of varying collector widths and xgaps in the ground underneath as well as on the rear irradiance for bifacial AgriPV. The optimization varies the numpanels combinations with xgaps for having 3-up and 4-up collectors with varying space along the row (xgap). The actual raytracing is not performed in the jupyter journal but rather on the HPC, but the geometry is the same as presented here.\n", "\n", "The steps on this journal:\n", "1. Making Collectors for each number panel and xgap case \n", "2. Builds the Scene so it can be viewed with rvu \n", "\n", "\n", "An area of 40m x 20 m area is sampled on the HPC, and is highlighted in the visualizations below with an appended terrain of 'litesoil'. The image below shows the two extremes of the variables optimized and the raytrace results, including the worst-case shading experienced under the array ( 100 - min_irradiance *100 / GHI).\n", "\n", "\n", "\n", "![AgriPV Collector Width and Xgap Optimization](../images_wiki/AdvancedJournals/AgriPV_CWandXgap_Optimization.PNG)\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "a07fb063", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Your simulation will be stored in C:\\Users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\TEMP\\Tutorial_16\n" ] } ], "source": [ "import os\n", "from pathlib import Path\n", "\n", "testfolder = Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'Tutorial_16'\n", "if not os.path.exists(testfolder):\n", " os.makedirs(testfolder)\n", "\n", "print (\"Your simulation will be stored in %s\" % testfolder)\n" ] }, { "cell_type": "code", "execution_count": 2, "id": "945f4b69", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "path = C:\\Users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\TEMP\\Tutorial_16\n", "Making path: images\n", "Making path: objects\n", "Making path: results\n", "Making path: skies\n", "Making path: EPWs\n", "Making path: materials\n" ] } ], "source": [ "import bifacial_radiance\n", "import numpy as np\n", "\n", "rad_obj = bifacial_radiance.RadianceObj('tutorial_16', str(testfolder)) \n" ] }, { "cell_type": "markdown", "id": "22b12ab1", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "id": "6db435f0", "metadata": {}, "source": [ "## 1. Making Collectors for each number panel and xgap case" ] }, { "cell_type": "code", "execution_count": 3, "id": "33320afb", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Module Name: test-module_3up_0.9xgap\n", "Module test-module_3up_0.9xgap updated in module.json\n", "\n", "Module Name: test-module_3up_1.2xgap\n", "Module test-module_3up_1.2xgap updated in module.json\n", "\n", "Module Name: test-module_3up_1.8xgap\n", "Module test-module_3up_1.8xgap updated in module.json\n", "\n", "Module Name: test-module_3up_2.7xgap\n", "Module test-module_3up_2.7xgap updated in module.json\n", "\n", "Module Name: test-module_3up_3.7xgap\n", "Module test-module_3up_3.7xgap updated in module.json\n", "\n", "Module Name: test-module_3up_4.6xgap\n", "Module test-module_3up_4.6xgap updated in module.json\n", "\n", "Module Name: test-module_3up_5.5xgap\n", "Module test-module_3up_5.5xgap updated in module.json\n", "\n", "Module Name: test-module_3up_6.4xgap\n", "Module test-module_3up_6.4xgap updated in module.json\n", "\n", "Module Name: test-module_4up_0.9xgap\n", "Module test-module_4up_0.9xgap updated in module.json\n", "\n", "Module Name: test-module_4up_1.2xgap\n", "Module test-module_4up_1.2xgap updated in module.json\n", "\n", "Module Name: test-module_4up_1.8xgap\n", "Module test-module_4up_1.8xgap updated in module.json\n", "\n", "Module Name: test-module_4up_2.7xgap\n", "Module test-module_4up_2.7xgap updated in module.json\n", "\n", "Module Name: test-module_4up_3.7xgap\n", "Module test-module_4up_3.7xgap updated in module.json\n", "\n", "Module Name: test-module_4up_4.6xgap\n", "Module test-module_4up_4.6xgap updated in module.json\n", "\n", "Module Name: test-module_4up_5.5xgap\n", "Module test-module_4up_5.5xgap updated in module.json\n", "\n", "Module Name: test-module_4up_6.4xgap\n", "Module test-module_4up_6.4xgap updated in module.json\n" ] } ], "source": [ "x = 2\n", "y = 1\n", "ygap = 0.1524 # m = 6 in\n", "zgap = 0.002 # m, veyr little gap to torquetube.\n", "\n", "tubeParams = {'diameter':0.15,\n", " 'tubetype':'square',\n", " 'material':'Metal_Grey',\n", " 'axisofrotation':True,\n", " 'visible': True}\n", "\n", "ft2m = 0.3048\n", "xgaps = [3, 4, 6, 9, 12, 15, 18, 21]\n", "numpanelss = [3, 4]\n", "\n", "\n", "# Loops\n", "for ii in range(0, len(numpanelss)):\n", " numpanels = numpanelss[ii]\n", " for jj in range(0, len(xgaps)):\n", " xgap = xgaps[jj]*ft2m\n", "\n", " moduletype = 'test-module_'+str(numpanels)+'up_'+str(round(xgap,1))+'xgap'\n", " rad_obj.makeModule(moduletype, \n", " x=x, y=y, \n", " xgap=xgap, zgap=zgap, ygap = ygap, numpanels=numpanels, \n", " tubeParams=tubeParams)\n", "\n" ] }, { "cell_type": "markdown", "id": "25188bb7", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "id": "e9404ca4", "metadata": {}, "source": [ "## 2. Build the Scene so it can be viewed with rvu" ] }, { "cell_type": "code", "execution_count": 4, "id": "c404709c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Loading albedo, 1 value(s), 0.350 avg\n", "1 nonzero albedo values.\n", "Getting weather file: PRI_Mercedita.AP.785203_TMY3.epw\n", " ... OK!\n", "8760 line in WeatherFile. Assuming this is a standard hourly WeatherFile for the year for purposes of saving Gencumulativesky temporary weather files in EPW folder.\n", "Coercing year to 2021\n", "Saving file EPWs\\metdata_temp.csv, # points: 8760\n", "Calculating Sun position for Metdata that is right-labeled with a delta of -30 mins. i.e. 12 is 11:30 sunpos\n", "Created tutorial_16.oct\n", "\n", "Custom Object Name objects\\SampleArea.rad\n", "Created tutorial_16.oct\n" ] } ], "source": [ "xgaps = np.round(np.array([3, 4, 6, 9, 12, 15, 18, 21]) * ft2m,1)\n", "numpanelss = [3, 4]\n", "sensorsxs = np.array(list(range(0, 201))) \n", "\n", "# Select CASE:\n", "xgap = np.round(xgaps[-1],1)\n", "numpanels = 4\n", "\n", "# All the rest\n", "\n", "ft2m = 0.3048\n", "hub_height = 8.0 * ft2m\n", "y = 1\n", "pitch = 0.001 # If I recall, it doesn't like when pitch is 0 even if it's a single row, but any value works here. \n", "ygap = 0.15\n", "tilt = 18\n", "\n", "sim_name = ('Coffee_'+str(numpanels)+'up_'+\n", " str(round(xgap,1))+'_xgap')\n", "\n", "albedo = 0.35 # Grass value from Torres Molina, \"Measuring UHI in Puerto Rico\" 18th LACCEI \n", " # International Multi-Conference for Engineering, Education, and Technology\n", "\n", "azimuth = 180\n", "if numpanels == 3:\n", " nMods = 9\n", "if numpanels == 4:\n", " nMods = 7\n", "nRows = 1\n", "\n", "moduletype = 'test-module_'+str(numpanels)+'up_'+str(round(xgap,1))+'xgap'\n", "\n", "rad_obj.setGround(albedo)\n", "lat = 18.202142\n", "lon = -66.759187\n", "metfile = rad_obj.getEPW(lat,lon)\n", "rad_obj.readWeatherFile(metfile)\n", "\n", "sceneDict = {'tilt':tilt,'pitch':pitch,'hub_height':hub_height,'azimuth':azimuth, 'nMods': nMods, 'nRows': nRows} \n", "scene = rad_obj.makeScene(module=moduletype,sceneDict=sceneDict, radname = sim_name)\n", "\n", "rad_obj.gendaylit(4020)\n", "\n", "\n", "octfile = rad_obj.makeOct(filelist = rad_obj.getfilelist(), octname = rad_obj.basename) \n", "\n", "name='SampleArea'\n", "text='! genbox litesoil cuteBox 40 20 0.01 | xform -t -20 -10 0.01'\n", "customObject =rad_obj.makeCustomObject(name,text)\n", "scene.appendtoScene(customObject)\n", "\n", "octfile = rad_obj.makeOct(rad_obj.getfilelist()) \n" ] }, { "cell_type": "markdown", "id": "3eee4373", "metadata": {}, "source": [ "\n", "### To View the generated Scene, you can navigate to the testfolder on a terminal and use:\n", "\n", "front view:\n", "> rvu -vf views\\front.vp -e .0265652 -vp 2 -21 2.5 -vd 0 1 0 makemod.oct\n", "\n", " top view: \n", "> rvu -vf views\\front.vp -e .0265652 -vp 5 0 70 -vd 0 0.0001 -1 makemod.oct\n", " \n", " Or run it directly from Jupyter by removing the comment from the following cell: \n" ] }, { "cell_type": "code", "execution_count": 5, "id": "07396db0", "metadata": {}, "outputs": [], "source": [ "\n", "## Comment the ! line below to run rvu from the Jupyter notebook instead of your terminal.\n", "## Simulation will stop until you close the rvu window\n", "\n", "#!rvu -vf views\\front.vp -e .0265652 -vp 2 -21 2.5 -vd 0 1 0 makemod.oct\n", "#!rvu -vf views\\front.vp -e .0265652 -vp 5 0 70 -vd 0 0.0001 -1 makemod.oct\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.8" } }, "nbformat": 4, "nbformat_minor": 5 }